import {ChangeDetectorRef, Component} from '@angular/core';
import { NavController, NavParams} from 'ionic-angular';
import {JidihttpProvider} from "../../providers/jidihttp/jidihttp";
import {UserxiugaiPage} from "../userxiugai/userxiugai";

/**
 * Generated class for the AboutpersonPage page.
 *
 * See https://ionicframework.com/docs/components/#navigation for more info on
 * Ionic pages and navigation.
 */

@Component({
  selector: 'page-aboutperson',
  templateUrl: 'aboutperson.html',
})
export class AboutpersonPage {
  imageuser:string;
  micheng:string;
  shouji:string;
  xingbie:string;
  dengluming:string;
  constructor(public navCtrl: NavController, public navParams: NavParams,public jidiProvider:JidihttpProvider,public cdchange:ChangeDetectorRef) {
    this.userinfo();
  }

  ionViewDidLoad() {
    console.log('ionViewDidLoad AboutpersonPage');
  }
  /** 网络请求 **/
  userinfo(){
    this.jidiProvider.getUserInfo().subscribe(data => {
      this.imageuser = data['data']['img'];
      this.micheng= data['data']['webchatName'];
      if(1== data['data']['sex']){
        this.xingbie ="男";
      }else{
        this.xingbie= "女";
      }
      this.shouji= data['data']['photo'];
      this.cdchange.detectChanges();
    },error => {

    });
  }

  /** 修改信息 **/
  xiugaiEvent(){
    this.navCtrl.push(UserxiugaiPage,{imgg:this.imageuser});
  }
}
